﻿<%@ Page Title="Página principal" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
	CodeBehind="Default.aspx.cs" Inherits="TraceThisItem.WebUI._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
	<h1>
		Mis incidencias
	</h1>
	<p>
		<asp:Label Text="Proyecto:" runat="server" AssociatedControlID="ProjectDropDownList" />
		<asp:DropDownList ID="ProjectDropDownList" runat="server" AutoPostBack="True" DataSourceID="ProjectDataSource"
			DataTextField="Name" DataValueField="Id">
			<asp:ListItem Text="No hay proyectos" />
		</asp:DropDownList>
	</p>
	<asp:GridView ID="MyItemsGridView" runat="server" AutoGenerateColumns="False" Width="100%"
		DataSourceID="MyItemsDataSource" EmptyDataText="No hay incidencias para este proyecto">
		<Columns>
			<asp:BoundField DataField="Id" HeaderText="Item #" SortExpression="Id" DataFormatString="{0:0000}"
				ItemStyle-HorizontalAlign="Center">
				<ItemStyle HorizontalAlign="Center"></ItemStyle>
			</asp:BoundField>
			<asp:HyperLinkField DataNavigateUrlFields="Id" DataTextField="Subject" HeaderText="Asunto"
				DataNavigateUrlFormatString="~/Items/Details.aspx?id={0}" NavigateUrl="~/Items/Details.aspx" />
			<asp:BoundField DataField="CreatedOn" HeaderText="Creado" SortExpression="CreatedOn" />
			<asp:BoundField DataField="LatestUpdate" HeaderText="Actualizado" SortExpression="LatestUpdate" />
			<asp:TemplateField HeaderText="Estado Actual">
				<ItemTemplate>
					<asp:Label ID="lblEstadoActual" runat="server" Text='<%# Eval("CurrentStatus") %>'></asp:Label>
				</ItemTemplate>
			</asp:TemplateField>
			<asp:TemplateField HeaderText="Responsable Actual">
				<ItemTemplate>
					<asp:Label ID="lblCurrentResponsible" runat="server" 
						Text='<%# Eval("CurrentResponsible") %>'></asp:Label>
				</ItemTemplate>
			</asp:TemplateField>
		</Columns>
	</asp:GridView>
	<asp:ObjectDataSource ID="ProjectDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
		SelectMethod="GetProjectsByUser" TypeName="TraceThisItem.Domain.Facade" OnObjectCreating="ProjectDataSource_ObjectCreating"
		OnSelecting="ProjectDataSource_Selecting"></asp:ObjectDataSource>
	<asp:ObjectDataSource ID="MyItemsDataSource" runat="server" OldValuesParameterFormatString="original_{0}"
		SelectMethod="GetItemsByProject" TypeName="TraceThisItem.Domain.Facade" OnObjectCreating="MyItemsDataSource_ObjectCreating">
		<SelectParameters>
			<asp:ControlParameter ControlID="ProjectDropDownList" Name="projectId" PropertyName="SelectedValue"
				Type="Int32" />
		</SelectParameters>
	</asp:ObjectDataSource>
</asp:Content>
